import { defineStore } from 'pinia'

export const useStore = defineStore('index',
  {
    state: () => ({
      shophistory:[],//商城历史搜索
      shopnum:0,//购物车数量
      shopcar:[],//购物车商品列表
      caihistory:[],
      immediatelybuy:[],//购物结算列表
      follow:[],
      address:[],//收货地址
      search:'',
      comment: [//评论
        {
          n: "寄中寄中寄",
          p: "http://i1.douguo.net/upload/photo/1/1/1/70_a5f8400664052cdd91d1ad457d121e16.png",
          city: "威海市",
          lvl: 1,
          good: 12,
          content: "书吗",
          bool: false
        },
        {
          n: "混子",
          p: "http://i1.douguo.net/upload/photo/1/1/1/70_004976861ec13b4af62b1d8db8c5c9f7.png",
          city: "扬州市",
          lvl: 2,
          good: 56,
          content: "白兰",
          bool: false
        },
        {
          n: "七七",
          p: "http://i1.douguo.net/upload/photo/f/3/8/70_u22546342328450409003004.jpg",
          city: "宁波市",
          lvl: 3,
          good: 9,
          content: "什么东西",
          bool: false
        },
      ],
      search_history: [//搜索历史
        
      ],
      scrolltop:"",
      order:[],//订单
      noorder:[],//不结算
      delivergoods:[],//发货
      evaluated:[],//评价
      mycomment:[],//我的评价
      wite:{
        src:'',
        tit:''
      }
    }),
  

    persist:{
      enabled: true,//这个配置代表存储生效，而且是整个store都存储
      storage: sessionStorage,
      // strategies:[
      //       {storage: sessionStorage,paths: ['books','user']},// 字段用sessionStorage存储
      //       {storage: localstorage,paths: ['libers']},// 字段用 localstorage存储
      // ],
    }

  })
